<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="../resources/css/styles.css">
    <script type="text/javascript" src="../resources/js/d3.js"></script>
</head>
<body>
<section id="selection1">
    <div>
        <p>blue box</p>
    </div>
</section>
<section id="selection2">
    <div>
        <p>red box</p>
    </div>
</section>

<script type="text/javascript">
    d3.select("#selection1 > div")
            .attr("class", "blue box");
    d3.select("#selection2")
            .select("div")
            .attr("class", "red box");
</script>
</body>
</html>